<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script type="text/ecmascript-6">
    import {getSysParams} from '@/api/common'
    import {getToken} from '@/utils/auth'

    // if(getToken()&&/login/.test(location.pathname)){
    //     window.location.href = `${location.protocol}//${location.host}/`
    // }

    export default {
        name: 'App',
        created() {
            //getToken("operation_token")?this.getSysEnums():null
            if (getToken('token')) {
                // if (/login/.test(this.$route.path)) {
                //     this.$router.push({path: '/'})
                // }
                // this.getSysEnums()
            } else {
              //this.redirect||this.$router.push({path: `/login?redirectUrl=${encodeURIComponent(window.location.href)}`})
            }
        },
        watch: {
            /*$route: {
                handler: function (route) {
                    // this.redirect = route.query && route.query.redirectUrl
                },
                immediate: true
            }*/
        },
        methods: {
            /*getSysEnums() {
                getSysParams().then(res => {
                    if (res.code === '200') {
                        const enums = res.body;
                        let data = {
                            ossDir: JSON.parse(enums.ossUploadDir.value),
                            videoCateId: JSON.parse(enums.vodParams.value)
                        }
                        this.$store.commit("saveSysEnums", data);
                        console.log(this.$store.getters);
                    }
                })
            }*/

        }
    }
</script>
